package com.gee.spring.boot.rpf.client.exicr2;

import cn.hutool.json.JSONObject;
import com.gee.spring.boot.rpf.controller.fico.RequestWrapper;
import com.gee.thread.flow.executor.ExecuteContext;
import com.gee.thread.flow.translator.V2PTranslator;
import org.springframework.stereotype.Component;

/**
 * desc:
 *
 * @author gee wrote on  2021-02-03 17:07:12
 */
@Component
public class ExiCr2RequestInitializer implements V2PTranslator<RequestWrapper, ExiCr2Request> {

    @Override
    public ExiCr2Request translate(String preWorkId, ExecuteContext<RequestWrapper> executeContext) {
        ExiCr2Request exiCr2Request = new ExiCr2Request();
        JSONObject variable = executeContext.getVariable().getRequest();
        exiCr2Request.setCertId(variable.get("certId", String.class));
        exiCr2Request.setCstName(variable.get("customerName", String.class));
        return exiCr2Request;
    }
}
